// Copyright (c) 2022 Presto Labs Pte. Ltd.
// Author: fengyang

#pragma once

#include <cstdint>

namespace coin2::exchange::base::feed::timer {
namespace impl {

class FeedTimer {
 public:
  explicit FeedTimer() {}
  void SetTimestamp(int64_t timestamp) { timestamp_ = timestamp; }
  // now as nanosecond
  int64_t Timestamp() const { return timestamp_; }

  // timer id to trrigger
  void SetTimerId(int64_t timer_id) { timer_id_ = timer_id; }
  int64_t TimerId() const { return timer_id_; }

 private:
  uint64_t timer_id_ = 0;
  int64_t timestamp_ = 0;
};

}  // namespace impl

using impl::FeedTimer;

}  // namespace coin2::exchange::base::feed::timer

inline std::ostream& operator<<(
    std::ostream& os,
    const coin2::exchange::base::feed::timer::FeedTimer& timer) {
  os << "Timer ";
  os << "(id=";
  os << timer.TimerId();
  os << ", timestamp = ";
  os << timer.Timestamp();
  os << ")";
  return os;
}
